/*
 * NastaveniVrsekButton.java
 *
 * Created on 19. �erven 2007, 18:08
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package cz.possoft.client.gui.panel;

import java.awt.Color;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;

import cz.possoft.client.gui.panel.nastavenivrchnipanel.components.NacteniMenuButton;
import cz.possoft.client.gui.panel.nastavenivrchnipanel.components.NastaveniMenuButton;
import cz.possoft.client.gui.panel.nastavenivrchnipanel.components.ProhraMenuButton;
import cz.possoft.client.gui.panel.nastavenivrchnipanel.components.RemizaMenuButton;
import cz.possoft.client.gui.panel.nastavenivrchnipanel.components.UlozeniMenuButton;
import cz.possoft.messages.PropertiesManager;
import cz.possoft.messages.Text;
import layout.TableLayout;

/**
 * Predstavuje panel aplikace vpravo nahore s tlacitkama. Podle stisknuteho tlacitka
 * se zobrazuje spodni panel
 * 
 * @author mara
 */
public class NastaveniVrchniPanel extends JPanel {
    
    // Tento panel predstavuje spodni panel, ktery je pod timto panelem. Predava se v konstruktoru
   private static NastaveniSpodniPanel nastaveniSpodniPanel;
    
    double size[][] =
        {{50,150,50},
        {32,32,32,32,32,32,32,32,32,32,32}};
    
    private static NastaveniMenuButton nastaveniMenuButton;
    private static UlozeniMenuButton ulozeniMenuButton;
    private static NacteniMenuButton nacteniMenuButton;
    private static RemizaMenuButton remizaMenuButton;
    private static ProhraMenuButton prohraMenuButton;
    
    /** Creates a new instance of NastaveniVrsekButton */
    public NastaveniVrchniPanel() {
//        setText("");
//        setEnabled(false);
        nastaveniSpodniPanel = NastaveniSpodniPanel.getNastaveniSpodniPanel();
        setBorder(new LineBorder(new Color(150,150,200)));
        setLayout(new TableLayout(size));
        initContent();
    }
    
    public void initContent() {                
        add(getNastaveniMenuButton(), "1,1");
        add(getUlozeniMenuButton(), "1,3");
        add(getNacteniMenuButton(), "1,5");
        add(getRemizaMenuButton(), "1,7");
        add(getProhraMenuButton(), "1,9");                
    }

    public static NacteniMenuButton getNacteniMenuButton() {
        if (nacteniMenuButton == null) {
            nacteniMenuButton = new NacteniMenuButton(PropertiesManager.getInstance().getMessageForKey(Text.LOADGAME));
        }
        return nacteniMenuButton;
    }

    public static NastaveniMenuButton getNastaveniMenuButton() {
        if (nastaveniMenuButton == null) {
            nastaveniMenuButton = new NastaveniMenuButton(PropertiesManager.getInstance().getMessageForKey(Text.NASTAVENI));
        }
        return nastaveniMenuButton;
    }

    public static ProhraMenuButton getProhraMenuButton() {
        if (prohraMenuButton == null) {
            prohraMenuButton = new ProhraMenuButton(PropertiesManager.getInstance().getMessageForKey(Text.PROHRANAVRH));
        }
        return prohraMenuButton;
    }

    public static RemizaMenuButton getRemizaMenuButton() {
        if (remizaMenuButton == null) {
            remizaMenuButton = new RemizaMenuButton(PropertiesManager.getInstance().getMessageForKey(Text.REMIZANAVRH));
        }
        return remizaMenuButton;
    }

    public static UlozeniMenuButton getUlozeniMenuButton() {
        if (ulozeniMenuButton == null) {
            ulozeniMenuButton = new UlozeniMenuButton(PropertiesManager.getInstance().getMessageForKey(Text.SAVEGAME));
        }
        return ulozeniMenuButton;
    }        
   
}
